#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	int u,d,sum;
	sum = 0;
	int maxn = 0;
	for(int i = 0;i<n;i++)
	{
		scanf("%d %d",&d,&u);
		sum += (u-d);
		if(sum>maxn) maxn = sum;
	}
	printf("%d\n",maxn);
}
